Apply cross-validation settings consistently - #1130
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 5f8b23e3db
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| "shuffle": True, | ||
| "random_state": self.random_state, | ||
| **cv_kwargs, |
There was a problem hiding this comment.
Clear random_state when disabling shuffle
When a within-session evaluation has random_state set and supplies cv_kwargs={"shuffle": False}, this merge retains the evaluation's non-None random state while overriding only shuffle. WithinSessionSplitter.__init__ then raises ValueError("random_state should be None when shuffle is False"), so the newly supported shuffle override cannot be used with an otherwise valid seeded evaluation. The identical merge in WithinSubjectEvaluation._create_splitter has the same failure; omit the inherited seed when the effective shuffle setting is false.
Useful? React with 👍 / 👎.
| cv_kwargs = { | ||
| name: value for name, value in cv_kwargs.items() if name in parameters |
There was a problem hiding this comment.
Preserve defaults for CV constructors accepting kwargs
When a custom cross-validator constructor accepts forwarded options through **kwargs rather than naming every parameter, this filter incorrectly treats all defaults as incompatible. For example, a GroupKFold subclass with __init__(self, **kwargs) can accept n_splits, but CrossSubjectEvaluation(n_splits=3, cv_class=Subclass) drops that value here and silently uses the subclass's underlying default fold count instead. Detect a variadic keyword parameter and retain compatible defaults in that case.
Useful? React with 👍 / 👎.
Evaluation splitter construction silently discards valid cross-validation settings.
This change applies caller cross-validation settings during splitter construction.
Closes #1110.